package com.yzh.oop1;

/**
 * @author 于振晗
 * @title: Cat
 * @description: TODO 猫类
 * @date 2020年08月25日
 * @path com.yzh.animal
 */
public class Dog extends Animal {
    private String nickName;//昵称

    public Dog(String color, int age) {
        super(color, age);
    }

    public Dog(String color, int age, String nickName) {
        super(color, age);
        this.nickName = nickName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "color='" + super.getColor() + '\'' +
                ",age=" + super.getAge() +
                ",nickName='" + nickName + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        super.equals(o);
        Dog dog = (Dog)o;
        if (this.nickName.equals(dog.getNickName())) {
            return true;
        }else{
            return false;
        }
    }
}
